#include "rangingProtocol.h"
// #include "stm32f4xx_hal.h"
#include "stdlib.h"

void initRandomSeed(){
    srand(RAND_SEED);
}


//randomly choose a node Number and change node order, to put the nextTag to last one. 
uint8_t genNextTag(uint8_t* nodesAddr, uint8_t nodeNumber ){
    uint8_t nextTag;
    uint8_t tempAddr;
    nextTag  = rand()%nodeNumber;

    //change order
    tempAddr = *(nodesAddr+ nextTag);
    *(nodesAddr+ nextTag) = *(nodesAddr+ nodeNumber -1 );
    *(nodesAddr+ nodeNumber -1 ) = tempAddr;
    return *(nodesAddr+ nodeNumber -1);
}
